package com.rs.qm.modules.sys.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.rs.qm.common.utils.PageUtils;
import com.rs.qm.common.utils.Query;
import com.rs.qm.modules.sys.dao.SysAreaDao;
import com.rs.qm.modules.sys.entity.SysAreaEntity;
import com.rs.qm.modules.sys.service.SysAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("sysAreaService")
public class SysAreaServiceImpl extends ServiceImpl<SysAreaDao, SysAreaEntity> implements SysAreaService {
    @Autowired
    private SysAreaDao sysAreaDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<SysAreaEntity> page = this.selectPage(
                new Query<SysAreaEntity>(params).getPage(),
                new EntityWrapper<>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<SysAreaEntity> queryProvinces() {
        return sysAreaDao.queryProvinces();
    }

    @Override
    public List<SysAreaEntity> queryCtiysByProvinceCode(String provinceCode) {
        return sysAreaDao.queryCtiysByProvinceCode(provinceCode);
    }

}